3.3 \(\int \frac{\cos ^2(x)}{i+\cot (x)} \, dx\)

Optimal. Leaf size=50 \[ -\frac{i x}{8}+\frac{i}{8 (-\cot (x)+i)}+\frac{i}{4 (\cot (x)+i)}+\frac{1}{8 (\cot (x)+i)^2} \]

[Out]

(-I/8)*x + (I/8)/(I - Cot[x]) + 1/(8*(I + Cot[x])^2) + (I/4)/(I + Cot[x])

________________________________________________________________________________________

Rubi [A]  time = 0.0604951, antiderivative size = 50, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 4, integrand size = 13, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.308, Rules used = {3516, 848, 88, 203} \[ -\frac{i x}{8}+\frac{i}{8 (-\cot (x)+i)}+\frac{i}{4 (\cot (x)+i)}+\frac{1}{8 (\cot (x)+i)^2} \]

Antiderivative was successfully verified.

[In]

Int[Cos[x]^2/(I + Cot[x]),x]

[Out]

(-I/8)*x + (I/8)/(I - Cot[x]) + 1/(8*(I + Cot[x])^2) + (I/4)/(I + Cot[x])

Rule 3516

Int[sin[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Dist[b/f, Subst[Int
[(x^m*(a + x)^n)/(b^2 + x^2)^(m/2 + 1), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x] && IntegerQ[m/
2]

Rule 848

Int[((d_) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_))^(n_)*((a_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[(d + e*x)
^(m + p)*(f + g*x)^n*(a/d + (c*x)/e)^p, x] /; FreeQ[{a, c, d, e, f, g, m, n}, x] && NeQ[e*f - d*g, 0] && EqQ[c
*d^2 + a*e^2, 0] && (IntegerQ[p] || (GtQ[a, 0] && GtQ[d, 0] && EqQ[m + p, 0]))

Rule 88

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Int[ExpandI
ntegrand[(a + b*x)^m*(c + d*x)^n*(e + f*x)^p, x], x] /; FreeQ[{a, b, c, d, e, f, p}, x] && IntegersQ[m, n] &&
(IntegerQ[p] || (GtQ[m, 0] && GeQ[n, -1]))

Rule 203

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTan[(Rt[b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rubi steps

\begin{align*} \int \frac{\cos ^2(x)}{i+\cot (x)} \, dx &=-\operatorname{Subst}\left (\int \frac{x^2}{(i+x) \left (1+x^2\right )^2} \, dx,x,\cot (x)\right )\\ &=-\operatorname{Subst}\left (\int \frac{x^2}{(-i+x)^2 (i+x)^3} \, dx,x,\cot (x)\right )\\ &=-\operatorname{Subst}\left (\int \left (-\frac{i}{8 (-i+x)^2}+\frac{1}{4 (i+x)^3}+\frac{i}{4 (i+x)^2}-\frac{i}{8 \left (1+x^2\right )}\right ) \, dx,x,\cot (x)\right )\\ &=\frac{i}{8 (i-\cot (x))}+\frac{1}{8 (i+\cot (x))^2}+\frac{i}{4 (i+\cot (x))}+\frac{1}{8} i \operatorname{Subst}\left (\int \frac{1}{1+x^2} \, dx,x,\cot (x)\right )\\ &=-\frac{i x}{8}+\frac{i}{8 (i-\cot (x))}+\frac{1}{8 (i+\cot (x))^2}+\frac{i}{4 (i+\cot (x))}\\ \end{align*}

Mathematica [A]  time = 0.0638667, size = 32, normalized size = 0.64 \[ -\frac{1}{32} i (4 x-\sin (4 x)-4 i \cos (2 x)-i \cos (4 x)) \]

Antiderivative was successfully verified.

[In]

Integrate[Cos[x]^2/(I + Cot[x]),x]

[Out]

(-I/32)*(4*x - (4*I)*Cos[2*x] - I*Cos[4*x] - Sin[4*x])

________________________________________________________________________________________

Maple [A]  time = 0.043, size = 37, normalized size = 0.7 \begin{align*}{\frac{-{\frac{i}{8}}}{\tan \left ( x \right ) +i}}+{\frac{\ln \left ( \tan \left ( x \right ) +i \right ) }{16}}+{\frac{1}{8\, \left ( \tan \left ( x \right ) -i \right ) ^{2}}}-{\frac{\ln \left ( \tan \left ( x \right ) -i \right ) }{16}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(x)^2/(I+cot(x)),x)

[Out]

-1/8*I/(tan(x)+I)+1/16*ln(tan(x)+I)+1/8/(tan(x)-I)^2-1/16*ln(tan(x)-I)

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: RuntimeError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)^2/(I+cot(x)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError

________________________________________________________________________________________

Fricas [A]  time = 1.57861, size = 138, normalized size = 2.76 \begin{align*} \frac{1}{32} \,{\left (4 i \, x e^{\left (4 i \, x\right )} +{\left (-8 i \, x e^{\left (2 i \, x\right )} - 2 \, e^{\left (4 i \, x\right )} + 2\right )} e^{\left (2 i \, x\right )} - 4 \, e^{\left (2 i \, x\right )} - 1\right )} e^{\left (-4 i \, x\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)^2/(I+cot(x)),x, algorithm="fricas")

[Out]

1/32*(4*I*x*e^(4*I*x) + (-8*I*x*e^(2*I*x) - 2*e^(4*I*x) + 2)*e^(2*I*x) - 4*e^(2*I*x) - 1)*e^(-4*I*x)

________________________________________________________________________________________

Sympy [A]  time = 0.456774, size = 34, normalized size = 0.68 \begin{align*} - \frac{i x}{8} - \frac{e^{2 i x}}{16} - \frac{e^{- 2 i x}}{16} - \frac{e^{- 4 i x}}{32} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)**2/(I+cot(x)),x)

[Out]

-I*x/8 - exp(2*I*x)/16 - exp(-2*I*x)/16 - exp(-4*I*x)/32

________________________________________________________________________________________

Giac [A]  time = 1.24158, size = 69, normalized size = 1.38 \begin{align*} -\frac{-i \, \tan \left (x\right ) + 3}{16 \,{\left (-i \, \tan \left (x\right ) + 1\right )}} + \frac{3 \, \tan \left (x\right )^{2} - 6 i \, \tan \left (x\right ) + 1}{32 \,{\left (\tan \left (x\right ) - i\right )}^{2}} + \frac{1}{16} \, \log \left (\tan \left (x\right ) + i\right ) - \frac{1}{16} \, \log \left (\tan \left (x\right ) - i\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)^2/(I+cot(x)),x, algorithm="giac")

[Out]

-1/16*(-I*tan(x) + 3)/(-I*tan(x) + 1) + 1/32*(3*tan(x)^2 - 6*I*tan(x) + 1)/(tan(x) - I)^2 + 1/16*log(tan(x) +
I) - 1/16*log(tan(x) - I)